/*
 * @Author: zhangyang
 * @Date: 2022-02-24 17:49:16
 * @LastEditTime: 2022-02-24 19:15:42
 * @Description: 存储用户相关信息
 */
import { defineStore, acceptHMRUpdate } from 'pinia';
import type { RouteRecordRaw } from 'vue-router';
import { routes } from '../route';

export const useUserStore = defineStore('useUserStore', () => {
  const UserInfo = ref<UserInfo>();
  const NavArr = ref<NavArrItem[]>([]);
  const LeftNav = ref<NavArrItem[]>([]);
  const RoleRoute = ref<string[]>([]);
  const AppConfig = ref<App_Config>({
    sidebar_opened: true
  });
  const AllRoutes = ref<RouteRecordRaw[]>(deepClone(routes));
  return {
    UserInfo,
    NavArr,
    LeftNav,
    RoleRoute,
    AppConfig,
    AllRoutes
  };
});

import.meta.hot && import.meta.hot.accept(acceptHMRUpdate(useUserStore, import.meta.hot));
